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
Copy file name to clipboardExpand all lines: articles/ai-services/agents/overview.md
+25-4Lines changed: 25 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,15 +19,36 @@ Azure AI Agent Service is a fully managed service designed to empower developers
19
19
20
20
Within Azure AI Foundry, an AI Agent acts as a "smart" microservice that can be used to answer questions (RAG), perform actions, or completely automate workflows. It achieves this by combining the power of generative AI models with tools that allow it to access and interact with real-world data sources.
21
21
22
-
// Add a diagram here
23
-
24
22
Because Azure AI Agent Service uses the same wire protocol as [Azure OpenAI Assistants](/azure/ai-services/openai/how-to/assistant), you can use either [OpenAI SDKs](./quickstart.md?pivots=programming-language-python-openai) or [Azure AI Foundry SDKs](./quickstart.md?programming-language-python-azure) to create and run an agent in just a few lines of code. For example, to create an AI Agent with Azure AI Foundry SDK, you can simply define which model the AI uses, the instructions for how it should complete tasks, and the tools it can use to access and interact with other services.
25
23
26
-
// Add code here
24
+
```python
25
+
agent = project_client.agents.create_agent(
26
+
model="gpt-4o-mini",
27
+
name="my-agent",
28
+
instructions="You are helpful agent",
29
+
tools=code_interpreter.definitions,
30
+
tool_resources=code_interpreter.resources,
31
+
)
32
+
```
27
33
28
34
After defining an agent, you can start asking it to perform work by invoking a run on top of an activity thread, which is simply a conversation between multiple agents and users.
29
35
30
-
// Add code here
36
+
```python
37
+
# Create a thread with messages
38
+
thread = project_client.agents.create_thread()
39
+
message = project_client.agents.create_message(
40
+
thread_id=thread.id,
41
+
role="user",
42
+
content="Could you please create a bar chart for the operating profit using the following data and provide the file to me? Company A: $1.2 million, Company B: $2.5 million, Company C: $3.0 million, Company D: $1.8 million",
43
+
)
44
+
45
+
# Ask the agent to perform work on the thread
46
+
run = project_client.agents.create_and_process_run(thread_id=thread.id, agent_id=agent.id)
47
+
48
+
# Fetch and log all messages to see the agent's response
Whenever the run operation is invoked, Azure AI Agent Service will complete the entire tool calling lifecycle for you by 1) running the model with the provided instructions, 2) invoking the tools as the agent calls them, and 3) returning the results back to you.
0 commit comments