You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e21140c
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: python/packages/foundry_hosting/README.md
+30-2Lines changed: 30 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,33 @@
2
2
3
3
This package provides the integration of Agent Framework agents and workflows with the Foundry Agent Server, which can be hosted on Foundry infrastructure.
4
4
5
+
## Agent instances and factories
6
+
7
+
`ResponsesHostServer` and `InvocationsHostServer` accept an agent instance or a zero-argument callable through the
8
+
existing `agent` parameter. The callable may be synchronous or asynchronous, must return an object implementing
9
+
`SupportsAgentRun`, and is invoked once for each request:
10
+
11
+
```python
12
+
server = ResponsesHostServer(agent=create_agent)
13
+
```
14
+
15
+
Passing an instance reuses that object for the lifetime of the host. Pass a callable when the agent keeps mutable state
16
+
outside `AgentSession`. In particular, a `WorkflowAgent` wraps a stateful workflow, so its callable should build a new
17
+
workflow, executors, and wrapped agents. Keep the workflow name and executor IDs stable so later requests can find and
18
+
restore its checkpoints:
19
+
20
+
```python
21
+
defcreate_agent():
22
+
return build_workflow().as_agent()
23
+
24
+
25
+
server = ResponsesHostServer(agent=create_agent)
26
+
```
27
+
28
+
The Responses host continues regular agents through its existing session store and workflow agents through its
29
+
existing checkpoint store. A callable does not make arbitrary instance fields persistent; state needed by later
30
+
requests must remain in the supported stores.
31
+
5
32
## Conversation history
6
33
7
34
`ResponsesHostServer` uses AgentServer response history as the model's conversation history by default:
@@ -21,8 +48,9 @@ AgentServer history requires a framework `RawAgent` whose client declares the bo
21
48
the agent's runtime options then let hosting enforce downstream storage behavior. Custom `SupportsAgentRun`
22
49
implementations must use `history_source="agent"` because that protocol does not accept runtime chat options.
23
50
24
-
`ResponsesHostServer` owns the supplied agent instance and may add hosting-specific context providers. Do not reuse that
25
-
agent with another host or invoke it directly after constructing the server.
51
+
`ResponsesHostServer` owns a supplied agent instance and may add hosting-specific context providers. Do not reuse that
52
+
instance with another host or invoke it directly after constructing the server. An agent returned by a callable belongs
53
+
to that request.
26
54
27
55
To preserve the agent's regular history and service-storage behavior, select the agent as the history source:
0 commit comments