> Source: https://builder-docs.ema.ai/agent-reference/core/custom-agent
> Title: Custom Agent

# Custom Agent

The Custom Agent is a general-purpose LLM agent that accepts any combination of inputs and produces text or structured outputs. It is the most flexible agent in the platform -- use it when no specialized agent fits your needs, or when you need to implement custom logic with LLM reasoning.

## Use Cases

-   No existing agent covers your specific task.
-   You need a flexible LLM step with custom instructions.
-   You want to prototype a new capability before requesting a dedicated agent.
-   You need to transform, analyze, or reason about data in a way not covered by other agents.
-   You need structured (typed/JSON) output from an LLM step.

## Inputs

Input

Type

Required

Description

`role_instructions`

Text

Yes

Role instructions defining the agent's behavior and personality (e.g., "You are a legal contract reviewer").

`task_instructions`

Text

No

Specific instructions for the task to accomplish. Use this for per-invocation guidance that is separate from the agent's role.

`named_inputs`

Any\[\]

Yes

At least one input must be provided. Accepts any type: text, search results, documents, conversations, entities, etc.

`output_fields`

ExtractionColumn\[\]

No

Define a structured output schema. When set, the agent returns typed fields instead of free-form text -- useful for downstream agents that expect structured data.

## Outputs

Output

Type

Description

`response_with_sources`

Text

The LLM-generated output based on your instructions, with source attribution when available.

## Configurations

Parameter

Description

Default

`role_instructions`

The primary prompt that defines the agent's behavior and personality. Set this in the agent's configuration panel.

Required

`task_instructions`

Per-task instructions that supplement the role. Useful when the same agent handles different tasks via different workflow paths.

None

`model_config`

Override the EmaFusion model selection for this agent. Auto-wired from the AI Employee's EmaFusion configuration unless overridden.

EmaFusion default

### Advanced Configuration

Parameter

Type

Description

`process_entire_document`

Boolean

When enabled, processes the full content of input documents rather than chunking.

`use_citation_based_filtering`

Boolean

Enforces citation grounding -- the agent must ground its response in the provided sources.

`disable_sources`

Boolean

Removes source attribution from the output.

`glossary`

GlossaryItem\[\]

Custom terminology definitions to ensure consistent, domain-accurate language in the response.

`user_tags`

String\[\]

User metadata tags for prompt personalization (e.g., country, role, department).

`data_protection_config`

DataProtectionConfig

PII handling configuration -- controls how sensitive data is obfuscated before being sent to the LLM.

## How to Use This Agent

A custom agent that extracts action items from meeting notes:

```
document_trigger -> custom_agent("Extract all action items with assignee and deadline from these meeting notes. Return as a numbered list.") -> send_email -> workflow_output
```

A custom agent that rewrites a knowledge base answer for a specific audience:

```
chat_trigger -> knowledge_search -> respond_to_a_query -> custom_agent("Rewrite the response for a non-technical audience") -> workflow_output
```

## Related Agents

-   [Respond to a Query](/legacy-docs/agent-reference/core/respond-to-a-query) -- similar but optimized for response generation with source grounding.
-   [Extract Entities](/legacy-docs/agent-reference/core/extract-entities) -- for structured entity extraction; prefer this over Custom Agent for that task.
-   [Custom Code Agent](/legacy-docs/agent-reference/core/custom-code-agent) -- for deterministic JavaScript logic; prefer this when you do not need LLM reasoning.
-   Specialized agents in the [Specialized Agents Catalog](/legacy-docs/agent-reference/specialized) -- pre-trained Custom Agent variants for specific domains.
